package com.hdaccp.personal.service.impl;

import com.hdaccp.personal.dao.ShoucangDao;
import com.hdaccp.personal.service.ShoucangSerivce;
import com.hdaccp.pojo.po.shop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;
import java.util.Queue;

@Service
public class ShoucangSericeImpl implements ShoucangSerivce {
    @Autowired
    private EntityManager entityManager;
    @Override
    public List<shop> querypage(int currentPage, int pageSize) {
        String jpql = "select n from shop n";
        Query query=entityManager.createQuery(jpql);
        query.setFirstResult((currentPage-1) * pageSize);
        query.setMaxResults(pageSize);
        return query.getResultList();
    }
}
